package com.zt.bus.order.model;

import com.zt.system.model.Entity;
import com.zt.util.DateUtil;
import net.sf.json.JSONObject;

import java.io.Serializable;
import java.util.Date;

public class Order extends Entity implements Serializable {
    private String id;

    private String lineId;

    private String lineName;

    private double price;

    private String planId;

    private String departTime;

    private String bookUserId;

    private String bookUserName;

    private String bookUserPhone;

    private Date startRideDate;

    private int passengersNum;

    private int days;

    private double amount;

    private String discountId;

    private String discountName;

    private String discountDetailId;

    private double discountedRate;

    private double discountedAmount;

    private double deductibleAmount;

    private double cashAmount;

    private double cashValue;

    private String status;

    private static final long serialVersionUID = 1L;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLineId() {
        return lineId;
    }

    public void setLineId(String lineId) {
        this.lineId = lineId;
    }

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getPlanId() {
        return planId;
    }

    public void setPlanId(String planId) {
        this.planId = planId;
    }

    public String getDepartTime() {
        return departTime;
    }

    public void setDepartTime(String departTime) {
        this.departTime = departTime;
    }

    public String getBookUserId() {
        return bookUserId;
    }

    public void setBookUserId(String bookUserId) {
        this.bookUserId = bookUserId;
    }

    public String getBookUserName() {
        return bookUserName;
    }

    public void setBookUserName(String bookUserName) {
        this.bookUserName = bookUserName;
    }

    public String getBookUserPhone() {
        return bookUserPhone;
    }

    public void setBookUserPhone(String bookUserPhone) {
        this.bookUserPhone = bookUserPhone;
    }

    public Date getStartRideDate() {
        return startRideDate;
    }

    public void setStartRideDate(Date startRideDate) {
        this.startRideDate = startRideDate;
    }

    public int getPassengersNum() {
        return passengersNum;
    }

    public void setPassengersNum(int passengersNum) {
        this.passengersNum = passengersNum;
    }

    public int getDays() {
        return days;
    }

    public void setDays(int days) {
        this.days = days;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getDiscountId() {
        return discountId;
    }

    public void setDiscountId(String discountId) {
        this.discountId = discountId;
    }

    public String getDiscountName() {
        return discountName;
    }

    public void setDiscountName(String discountName) {
        this.discountName = discountName;
    }

    public String getDiscountDetailId() {
        return discountDetailId;
    }

    public void setDiscountDetailId(String discountDetailId) {
        this.discountDetailId = discountDetailId;
    }

    public double getDiscountedRate() {
        return discountedRate;
    }

    public void setDiscountedRate(double discountedRate) {
        this.discountedRate = discountedRate;
    }

    public double getDiscountedAmount() {
        return discountedAmount;
    }

    public void setDiscountedAmount(double discountedAmount) {
        this.discountedAmount = discountedAmount;
    }

    public double getDeductibleAmount() {
        return deductibleAmount;
    }

    public void setDeductibleAmount(double deductibleAmount) {
        this.deductibleAmount = deductibleAmount;
    }

    public double getCashAmount() {
        return cashAmount;
    }

    public void setCashAmount(double cashAmount) {
        this.cashAmount = cashAmount;
    }

    public double getCashValue() {
        return cashValue;
    }

    public void setCashValue(double cashValue) {
        this.cashValue = cashValue;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public static JSONObject toJson(Order order) {

        JSONObject json = new JSONObject();
        json.put("orderId",order.getId());
        json.put("lineId",order.getLineId());
        json.put("lineName",order.getLineName());
        json.put("price",order.getPrice());
        json.put("planId",order.getPlanId());
        json.put("departTime",order.getDepartTime());
        json.put("bookUserId",order.getBookUserId());
        json.put("bookUserName",order.getBookUserName());
        json.put("bookUserPhone",order.getBookUserPhone());
        json.put("passengersNum",order.getPassengersNum());
        json.put("days",order.getDays());
        json.put("amount",order.getAmount());
        json.put("discountId",order.getDiscountId());
        json.put("discountName",order.getDiscountName());
        json.put("discountDetailId",order.getDiscountDetailId());
        json.put("discountedRate",order.getDiscountedRate());
        json.put("discountedAmount",order.getDiscountedAmount());
        json.put("deductibleAmount",order.getDeductibleAmount());
        json.put("cashAmount",order.getCashAmount());
        json.put("cashValue",order.getCashValue());
        json.put("status",order.getStatus());
        json.put("makeTime", DateUtil.formatDate(order.getMakeTime()));
        json.put("modifyTime",DateUtil.formatDate(order.getModifyTime()));
        json.put("startRideDate",DateUtil.formatDate(order.getStartRideDate()));
        return json;
    }
}